package Managers
{	
	import Menus.BaseMenu;

	//Manages things
	public class MenuManager extends BaseManager
	{
		private var currentMenu:BaseMenu;
		private var menus:Array = new Array();
		
		public function MenuManager(game:Game):void
		{
			super(game);
		}
		
		public function addMenu(menu:BaseMenu):void
		{
			menus.push(menu);
			game.TopClass.addChild(menu);
		}
		
		public override function Update(deltaTime:int):void
		{
			currentMenu.Update(deltaTime);
		}
		
		public function HandleInput(keyCode:uint):void
		{
			currentMenu.HandleInput(keyCode);
		}
		
		public function Hide():void
		{
			currentMenu.Hide();
		}
		
		public function Show():void
		{
			currentMenu.Show();
		}
		
		public function FindMenu(name:String):void
		{
			for(var index:int = 0; index < menus.length; index++)
			{
				if(menus[index].name == name)
				{
					currentMenu = menus[index];
				}
			}
		}
	}
}